﻿<!DOCTYPE html>
<html>
<head>
    <script src="../../js/header.js"></script>
</head>
<body>
    <div class="data-wrap case" id="container">
        <div class="data-tool clearfix">
            <div style="margin-left:20px;">
                <form class="form-inline" id="formSearch">
                    <a class="btn btn-info" href="/view/order/orderlist.html">返回订单列表</a>
                    <a class="btn btn-default m15_l" id="addOrderDetail" data-title="新增" data-width="452" data-height="385"><span class="glyphicon glyphicon-plus"></span> 新增</a>
                </form>
            </div>
        </div>
        <div class="paging">
        </div>
    </div>
    <script type="text/x-dot-template" id="templatePager">
        <div class="data-head">
            <table class="table">
                <thead>
                    <tr>
                        <th>订单号</th>
                        <th>卡商名称</th>
                        <th>银行名称</th>
                        <th>下单数量</th>
                        <th>单价</th>
                        <th>实际数量</th>
                        <th>实际单价</th>
                        <th>备注</th>
                        <th>创建日期</th>
                        <th width="200">操作</th>
                    </tr>
                </thead>
            </table>
        </div>

        <div class="data-body data-scroll">
            <div class="data-div-view">
                <table class="table table-hover">
                    <tbody>
                        {{~it.result :item:index}}
                        <tr>
                            <td>{{= item.orderNo }}</td>
                            <td>{{= item.cmName }}</td>
                            <td>{{= item.bankName }}</td>
                            <td>{{= item.orderQuantity}}</td>
                            <td>{{= item.unitPrice }}</td>
                            <td>{{= item.actualQuantity }}</td>
                            <td>{{= item.actualUnitPrice }}</td>
                            <td>{{= FlashPay.Util.GetShortStr(item.remark)}}</td>
                            <td>{{= FlashPay.Util.GetDateByTime(item.createDate)}}</td>
                            <td width="200">
                                {{? FlashPay.Util.GetQueryString("depositUID")==0 }}
                                <button type="button" class="btn btn-default m5_l" data-modal="/view/order/orderdetailedit.html?detailID={{= item.detailID}}&payUID={{=FlashPay.Util.GetQueryString("payUID")}}&depositUID={{=FlashPay.Util.GetQueryString("depositUID")}}&type=1"
                                        data-title="编辑 - {{= item.bankName }}" data-width="452" data-height="385">
                                    <span class="glyphicon glyphicon-edit"></span> 编辑
                                </button>
                                <a class="btn btn-danger m5_l"
                                   data-confirm='"{{= item.bankName }}" <br>确定要<span class="red">删除</span>该订单吗？'
                                   data-href="/OrderDetail/Delete?detailID={{= item.detailID}}"><span class="glyphicon glyphicon-trash"></span> 刪除</a>
                                {{? }}

                                {{? FlashPay.Util.GetQueryString("depositUID")!=0 && FlashPay.Util.GetQueryString("payUID")==0 }}
                                <button type="button" class="btn btn-default m5_l" data-modal="/view/order/ordereetailedit.html?detailID={{= item.detailID}}&payUID={{=FlashPay.Util.GetQueryString("payUID")}}&depositUID={{=FlashPay.Util.GetQueryString("depositUID")}}&type=2"
                                        data-title="编辑实际数量、实际单价" data-width="452" data-height="170">
                                    <span class="glyphicon glyphicon-edit"></span> 编辑实际数量、实际单价
                                </button>
                                {{? }}
                            </td>
                        </tr>
                        {{~}}
                    </tbody>
                </table>
            </div>
        </div>
        <!-- 必要的分页参数设置 -->
        <input type="hidden" id="TotalCount" value="{{=it.totalCount}}" />
    </script>
    <script type="text/javascript">
        $(function () {
            doSearch();
            //搜索
            $("#btnSearch").click(function () {
                doSearch();
            });
        });
        function doSearch() {
            var orderNo = FlashPay.Util.GetQueryString("orderNo");
            var depositUID = FlashPay.Util.GetQueryString("depositUID");
            if (depositUID > 0) {
                $("#addOrderDetail").remove();
            } else {
                $("#addOrderDetail").attr("data-modal", "/view/order/orderdetailedit.html?orderNo=" + orderNo + "&type=0");
            }
            var data = { orderNo: orderNo };
            FlashPay.UI.Pager(".paging", { templateId: "templatePager", othersData: data, ajax: { url: '/OrderDetail/Get', Method: 'Post' } });
        }
        function Tip_success(word) {
            FlashPay.UI.Tip_success(word);
        }
    </script>
</body>
</html>